var express = require('express')
var app = express()
var path = require('path')
var fs = require('fs')
var bodyPaser = require('body-parser')
var mongoose = require('mongoose')
//所有配置
require('./config/config')(__dirname, app)
var router = require('./config/routes')
app.use(bodyPaser.json());
app.use(bodyPaser.urlencoded({ extended: true }))
var port = process.env.PORT || 3000
var config = app.get("read");
mongoose.connect(app.get("mongoUrl"))

app.get("/user",router);
app.listen(config.port)
console.log("server is start at "+ config.port + "rootDir" + app.get('rootDir'))